package com.ogilvy.audi.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.ogilvy.audi.bean.Bulletin;
import com.ogilvy.audi.dao.BulletinDao;
import com.ogilvy.frame.hibernate.BaseDaoImpl;
@Repository
public class BulletinDaoImpl extends BaseDaoImpl<Bulletin> implements BulletinDao{
	public List<Bulletin> selectAll(){
		return null;
	}
	public List<Bulletin> selectAll(Map<String,Object> condition){
		StringBuffer hql = new StringBuffer("select b from Bulletin b join b.circle c where 1=1");
		if(null!=condition.get("circleId")){
			hql.append(" and c.circleId = ").append(condition.get("circleId"));
		}
		
		return getSession().createQuery(hql.toString()).list();
		
	}
	public List<Bulletin> selectAll(int pageNo, int pageSize,Map<String,Object> condition){
		StringBuffer hql = new StringBuffer("select b from Bulletin b join b.circle where 1=1");
		if(null!=condition.get("circleId")){
			hql.append("circleId = ").append(condition.get("circleId"));
		}
		
		return getSession().createQuery(hql.toString()).list();
		
	}
	

}
